export default {
	data() {
		return {}
	},
	methods: {
		goback() {
			let pages = getCurrentPages(); // 当前页面
			let page = getCurrentPages().pop(); // 当前页面
			let beforePage = pages[pages.length - 2]; // 上一页
			uni.navigateBack({
				success: () => {
					beforePage.onLoad(page.options); // 执行上一页的onLoad方法
				}
			});
		},

		// 如果time2大于time1 返回true 否则 返回false
		compareTime(time1, time2) {
			if (this.time_to_sec(time2) - this.time_to_sec(time1) > 0) {
				return true;
			}
			return false;
		},

		//将时分秒转为时间戳
		time_to_sec(time) {
			if (time !== null) {
				var s = "";
				var hour = time.split(":")[0];
				var min = time.split(":")[1];
				var sec = time.split(":")[2];
				s = Number(hour * 3600) + Number(min * 60) + Number(sec);
				return s;
			}
		},
	}
}
